package model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.vividsolutions.jts.geom.Point;

@Entity
@Table(name = "vademecummultimedia")
@SequenceGenerator(name="vmm_id", sequenceName="vademecummultimedia_id_seq", initialValue=1, allocationSize=1)
public class VadeMecumMultimedia {
	
	@Column(name = "filetype", nullable = false)
	private String filetype;
	
	@Id
	@Column(name = "id", nullable = false)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="vmm_id")
	private Integer id;
	
	@Column(name = "location", columnDefinition = "geometry")
	private Point location;
	
	@Column(name = "metadata", columnDefinition = "xml")
	private String metadata;

	//TODO
	private String result;
	
	@Column(name = "url", nullable = false)
	private String url;

	//empty constructor
	public VadeMecumMultimedia() { }

	public VadeMecumMultimedia(String url, String filetype) {
		setfileurl(url);
		setfiletype(filetype);
	}

	public VadeMecumMultimedia(String url, String filetype, String metadata) {
		setfileurl(url);
		setfiletype(filetype);
		setmetadata(metadata);		
	}	

	public VadeMecumMultimedia(String url, String filetype, String metadata, Point location) {
		setfileurl(url);
		setfiletype(filetype);
		setmetadata(metadata);
		setlocation(location);
	}
	
	public String getfiletype() {
		return filetype;
	}	
	
	public String getfileurl() {
		return url;
	}
	
	public Integer getId() {
		return id;
	}

	public Point getLocation() {
		return location;
	}

	public String getmetadata() {
		return metadata;
	}
	
	public String getResult() {
		return result;
	}

	public String getUrl() {
		return url;
	}

	public void setfiletype(String filetype) {
		this.filetype = filetype;
	}

	public void setfileurl(String url) {
		this.url = url;
	}
	
	public void setId(Integer id) {
		this.id = id;
	}	
	
	public void setlocation(Point location) {
		this.location = location;
	}	
	
	public void setmetadata(String metadata) {
		this.metadata = metadata;
	}

	public void setResult(String result) {
		this.result = result;
	}

	public void setUrl(String url) {
		this.url = url;
	}
	
	public String toString(){
		return "URL = " + getfileurl();
	}
}
